package com.teamclub.erp.scontrollers

import com.teamclub.erp.sforms.ProductSpecsForm
import com.teamclub.erp.sservices.ProductSpecsService
import com.teamclub.util.libs.Eithers
import org.apache.commons.lang3.StringUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.{PostMapping, RequestBody, RequestMapping, RestController}

/**
  * Created by ilkkzm on 17-9-12.
  */
@RestController("com.teamclub.erp.scontrollers.ProductSpecsController")
@RequestMapping(Array("/erp"))
class ProductSpecsController {
  @Autowired
  var productSpecsService: ProductSpecsService = _

  @PostMapping(Array("proudctspecdict"))
  def listDict(@RequestBody form: ProductSpecsForm) = {
    val resp = productSpecsService.listDict(form)
    Eithers.toJson(resp)
  }

  @PostMapping(Array("productspeclist"))
  def list(@RequestBody form: ProductSpecsForm) = {
    Eithers.toJson(productSpecsService.list(form))
  }

  @PostMapping(Array("productspecadd"))
  def add(@RequestBody form: ProductSpecsForm) = {
    Eithers.toJson(productSpecsService.add(form))
  }

  @PostMapping(Array("productspecdel"))
  def del(@RequestBody form: ProductSpecsForm) = {
    Eithers.toJson(productSpecsService.del(form))
  }

  @PostMapping(Array("listDealerProductList"))
  def listDealerProductList(@RequestBody form: ProductSpecsForm) = {
    Eithers.toJson(productSpecsService.listDealerProductList(form))
  }
}
